package com.draemon.haixiawenti.repository;

import com.yangzcp.userpojo.Tie;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;


/**
 * <p></p>
 *
 * @author  yangz
 * @date    2016/11/13
 * @version latest
 */
public interface TieRepository extends JpaRepository<Tie, Integer>{
    @Query("from Tie t order by t.create_time desc")
    public Page<Tie> findTies(Pageable pageable);
    @Query("from Tie t where ref_users.sign=?1 order by t.create_time desc")
    public List<Tie> findUserTieList(String sign);
    @Query("from Tie t where ref_users.sign=?1 and id=?2 order by t.create_time desc")
    public Tie getUserTie(String sign, Integer id);
}
